package com.guldan.thrall.web.controller;

import com.guldan.thrall.common.base.BaseController;
import com.guldan.core.response.ResponseJson;
import com.guldan.thrall.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created by Silas.
 * Date: 2016/10/1
 * Time: 22:38
 */
@Controller
public class IndexController extends BaseController {

    /*@Autowired
    private StaffProviderClient staffProviderClient;
*/
    @RequestMapping("/")
    public String index() {
//        logger.info("staffProviderClient.toString()" + staffProviderClient.toString());
//        staffProviderClient.authentication("33");

        try {


            logger.info("user-----" + UserUtils.getUser().getUserName());
        } catch (Exception ex) {
        }
        return "index";
    }

    /*@RequestMapping(value = "json", method = RequestMethod.GET)
    @ResponseJson
    public
    @ResponseBody
    String json() {
        return "hello guldan";
    }

    @RequestMapping("index/login")
    public String login(@CookieValue(value = "JSESSIONID", defaultValue = "") String JSESSIONID,
                        HttpServletRequest request,
                        HttpServletResponse response,
                        HttpSession session) {
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        logger.info("username: " + username + ", password: " + password + ", JSESSIONID: " + JSESSIONID);

        this.authLogin(username, password, JSESSIONID);

        return "index";
    }*/


    @RequestMapping("/mobile")
    public String mobile() {
        return "mobile";
    }

    @RequestMapping("/mobile2")
    public String mobile2() {
        return "mobile2";
    }

    @RequestMapping("/datav")
    public String datav() {
        return "datav";
    }
}
